home *** CD-ROM | disk | FTP | other *** search
- /*
- File: FireWireSBP2.h
-
- Contains: Public API for Serial Bus Protocol 2 (SBP-2)
-
- Version: 1.0
-
- Copyright: © 1998-1999 by Apple Computer, Inc., all rights reserved.
-
- File Ownership:
-
- DRI: Eric Anderson
-
- Other Contact:
-
- Technology: FireWire
-
- Writers:
-
- (EA) Eric Anderson (ewa)
- (CP) Collin Pieper
- (DCB) Clinton Bauder
-
- Change History (most recent first):
-
- <FW13> 2/22/99 EA Removed DeviceNotify.h.
- <FW12> 2/15/99 DCB Roll-in Eric's changes.
- <FW11a1> 2/7/99 EA Added kSBP2NormalCommandReset. Added generation flag/service
- for normal command objects. On a branch because the new
- services are also on a branch.
- <FW11> 1/7/99 CP Fix typo in FWGetSBP2CommandLUN definition
- <FW10> 1/3/99 EA Added enum for four ORB types (normal, reserved, vendor, and
- dummy).
- <FW9> 1/3/99 EA Changed pPassword from double to single pointer in Get/Set
- functions for Logins.
- <FW8> 1/3/99 EA Added FWGetSBP2NormalCommandObjectFromORB_POINTER.
- <FW7> 1/3/99 EA Added FWSetSBP2CommandLUN and FWGetSBP2CommandLUN prototypes.
- <FW6> 12/31/98 EA Removed obsolete kSBP2TerminateTask and kSBP2ClearTaskSet.
- <FW5> 11/18/98 EA Added command object ID to notification structure. Added
- routines to access clientData (refCon).
- <FW4> 11/15/98 EA Added prototype for FWGetSBP2LUNFromFWReferenceID.
- <FW3> 10/28/98 DCB Added structures for DFMDescriptor matching of SBP2 devices.
- <FW2> 9/20/98 EA Filled in header comments.
- <FW1> 9/20/98 EA first checked in
- */
-
-
-
- #ifndef __FIREWIRESBP2__
- #define __FIREWIRESBP2__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
- #ifndef __NAMEREGISTRY__
- #include <NameRegistry.h>
- #endif
- #ifndef __FIREWIRE__
- #include <FireWire.h>
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import on
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=power
- #endif
-
- ////////////////////////////////////////////////////////////////////////////////
- //
- // DFM structures for SBP2.
- //
-
- struct SBPDFMDataStruct
- {
- UInt32 vendorID;
- UInt32 softwareRev;
- UInt32 firmwareRev;
- UInt32 LUN;
- UInt32 devType;
- };
- typedef struct SBPDFMDataStruct
- SBPDFMData,
- *SBPDFMDataPtr;
-
- struct SBPMatchDataStruct
- {
- UnsignedWide vendorID;
- UnsignedWide softwareRev;
- UnsignedWide firmwareRev;
- UnsignedWide LUN;
- UnsignedWide devType;
- };
- typedef struct SBPMatchDataStruct
- SBPMatchData,
- *SBPMatchDataPtr;
-
-
- ////////////////////////////////////////////////////////////////////////////////
- //
- // Public FireWire SBP-2 defs.
- //
-
- // Login command object option flags:
-
- enum
- {
- kSBP2NotifyOnLoginComplete = (1 << 0),
- kSBP2NotifyOnLoginFailed = (1 << 1),
- kSBP2NotifyOnReconnecting = (1 << 2),
- kSBP2NotifyOnReconnectComplete = (1 << 3),
- kSBP2NotifyOnReconnectFailed = (1 << 4),
- kSBP2ExclusiveLogin = (1 << 5)
- };
-
-
- // Notification events:
-
- enum
- {
- kSBP2LoginComplete = 1,
- kSBP2LoginFailed = 2,
- kSBP2Reconnecting = 3,
- kSBP2ReconnectComplete = 4,
- kSBP2ReconnectFailed = 5,
- kSBP2NormalCommandStatus = 6,
- kSBP2NormalCommandTimeout = 7,
- kSBP2UnsolicitedStatus = 8,
- kSBP2NormalCommandReset = 9
- };
-
-
- // Normal command object option flags:
-
- enum
- {
- kSBP2CommandCompleteNotify = (1 << 0),
- kSBP2CommandTransferDataFromTarget = (1 << 1),
- kSBP2CommandImmediate = (1 << 2),
- kSBP2Command64BitBufferAddresses = (1 << 3),
- kSBP2CommandContiguousBuffers = (1 << 4),
- kSBP2CommandNormalORB = (1 << 5),
- kSBP2CommandReservedORB = (1 << 6),
- kSBP2CommandVendorORB = (1 << 7),
- kSBP2CommandDummyORB = (1 << 8),
- kSBP2CommandCheckGeneration = (1 << 9)
- };
-
-
- // Function codes for Management ORBs. Not all codes are available to drivers.
- // (Login, Reconnect, Logout are used automatically - do not try to use these.)
-
- enum
- {
- kSBP2Login = 0,
- kSBP2QueryLogins = 1,
- kSBP2Reconnect = 3,
- kSBP2SetPassword = 4,
- kSBP2Logout = 7,
- kSBP2AbortTask = 0xB,
- kSBP2AbortTaskSet = 0xC,
- kSBP2LogicalUnitReset = 0xE,
- kSBP2TargetReset = 0xF
- };
-
-
- struct FWClientSBP2NotifyParamsStruct
- {
- FWClientInterfaceParams fwClientInterfaceParams; // common params
- FWCommandObjectID fwCommandObjectID;
- UInt32 notificationEvent;
- Ptr message;
- UInt32 length;
- Ptr loginResponse;
- UInt32 notificationProcData;
- UInt32 generation;
- };
- typedef struct FWClientSBP2NotifyParamsStruct
- FWClientSBP2NotifyParams,
- *FWClientSBP2NotifyParamsPtr;
-
- typedef OSStatus (FWClientSBP2NotifyProc) (
- FWClientSBP2NotifyParamsPtr pFWClientSBP2NotifyParams,
- UInt32 *pCommandAcceptance);
- typedef FWClientSBP2NotifyProc *FWClientSBP2NotifyProcPtr;
-
-
- ////////////////////////////////////////////////////////////////////////////////
- //
- // Public FireWire SBP-2 API.
- //
-
- OSStatus FWAllocateSBP2LoginCommandObject (
- FWReferenceID fwReferenceID,
- FWCommandObjectID *pFWCommandObjectID);
-
- OSStatus FWSetSBP2LoginCommandPassword (
- FWCommandObjectID fwCommandObjectID,
- Ptr password,
- UInt32 length);
-
- OSStatus FWGetSBP2LoginCommandPassword (
- FWCommandObjectID fwCommandObjectID,
- Ptr password,
- UInt32 *pLength);
-
- OSStatus FWSetSBP2LoginCommandFlags (
- FWCommandObjectID fwCommandObjectID,
- UInt32 loginFlags);
-
- OSStatus FWGetSBP2LoginCommandFlags (
- FWCommandObjectID fwCommandObjectID,
- UInt32 *pLoginFlags);
-
- OSStatus FWSetSBP2LoginCommandMaxPayloadSize (
- FWCommandObjectID fwCommandObjectID,
- UInt32 maxPayloadSize);
-
- OSStatus FWGetSBP2LoginCommandMaxPayloadSize (
- FWCommandObjectID fwCommandObjectID,
- UInt32 *pMaxPayloadSize);
-
- OSStatus FWSetSBP2LoginCommandLoginNotifyProc (
- FWCommandObjectID fwCommandObjectID,
- FWClientSBP2NotifyProcPtr notificationProc,
- UInt32 notificationProcData);
-
- OSStatus FWGetSBP2LoginCommandLoginNotifyProc (
- FWCommandObjectID fwCommandObjectID,
- FWClientSBP2NotifyProcPtr *pNotificationProc,
- UInt32 *pNotificationProcData);
-
- OSStatus FWSetSBP2LoginCommandStatusNotifyProc (
- FWCommandObjectID fwCommandObjectID,
- FWClientSBP2NotifyProcPtr notificationProc,
- UInt32 notificationProcData);
-
- OSStatus FWGetSBP2LoginCommandStatusNotifyProc (
- FWCommandObjectID fwCommandObjectID,
- FWClientSBP2NotifyProcPtr *pNotificationProc,
- UInt32 *pNotificationProcData);
-
- OSStatus FWSetSBP2LoginCommandUnsolicitedStatusNotifyProc (
- FWCommandObjectID fwCommandObjectID,
- FWClientSBP2NotifyProcPtr notificationProc,
- UInt32 notificationProcData);
-
- OSStatus FWGetSBP2LoginCommandUnsolicitedStatusNotifyProc (
- FWCommandObjectID fwCommandObjectID,
- FWClientSBP2NotifyProcPtr *pNotificationProc,
- UInt32 *pNotificationProcData);
-
- OSStatus FWSetSBP2LoginCommandParams (
- FWCommandObjectID fwCommandObjectID,
- Ptr password,
- UInt32 length,
- UInt32 loginFlags,
- UInt32 maxPayloadSize,
- FWClientSBP2NotifyProcPtr loginNotificationProc,
- FWClientSBP2NotifyProcPtr statusNotificationProc,
- FWClientSBP2NotifyProcPtr unsolicitedStatusNotificationProc,
- UInt32 notificationProcData);
-
- OSStatus FWGetSBP2LoginCommandParams (
- FWCommandObjectID fwCommandObjectID,
- Ptr password,
- UInt32 *pLength,
- UInt32 *pLoginFlags,
- UInt32 *pMaxPayloadSize,
- FWClientSBP2NotifyProcPtr *pLoginNotificationProc,
- FWClientSBP2NotifyProcPtr *pStatusNotificationProc,
- FWClientSBP2NotifyProcPtr *pUnsolicitedStatusNotificationProc);
-
- OSStatus FWSetSBP2CommandLUN (
- FWCommandObjectID fwCommandObjectID,
- UInt32 logicalUnitNumber);
-
- OSStatus FWGetSBP2CommandLUN (
- FWCommandObjectID fwCommandObjectID,
- UInt32 *pLogicalUnitNumber);
-
- OSStatus FWAllocateSBP2NormalCommandObject (
- FWCommandObjectID fwLoginCommandObjectID,
- FWCommandObjectID *pFWCommandObjectID);
-
- OSStatus FWSetSBP2NormalCommandBuffers (
- FWCommandObjectID fwCommandObjectID,
- UInt32 bufferCount,
- FWAddress *bufferPtrList,
- UInt32 *bufferLengthList);
-
- OSStatus FWGetSBP2NormalCommandBuffers (
- FWCommandObjectID fwCommandObjectID,
- UInt32 *pBufferCount,
- FWAddress *bufferPtrList,
- UInt32 *bufferLengthList);
-
- OSStatus FWSetSBP2NormalCommandCommand (
- FWCommandObjectID fwCommandObjectID,
- Ptr commandBuffer,
- UInt32 commandLength);
-
- OSStatus FWGetSBP2NormalCommandCommand (
- FWCommandObjectID fwCommandObjectID,
- Ptr commandBuffer,
- UInt32 *pCommandLength);
-
- OSStatus FWSetSBP2NormalCommandFlags (
- FWCommandObjectID fwCommandObjectID,
- UInt32 normalFlags);
-
- OSStatus FWGetSBP2NormalCommandFlags (
- FWCommandObjectID fwCommandObjectID,
- UInt32 *pNormalFlags);
-
- OSStatus FWSetSBP2NormalCommandMaxPayloadSize (
- FWCommandObjectID fwCommandObjectID,
- UInt32 maxPayloadSize);
-
- OSStatus FWGetSBP2NormalCommandMaxPayloadSize (
- FWCommandObjectID fwCommandObjectID,
- UInt32 *pMaxPayloadSize);
-
- OSStatus FWSetSBP2NormalCommandTimeout (
- FWCommandObjectID fwCommandObjectID,
- Duration timeoutDuration);
-
- OSStatus FWGetSBP2NormalCommandTimeout (
- FWCommandObjectID fwCommandObjectID,
- Duration *pTimeoutDuration);
-
- OSStatus FWSetSBP2NormalCommandClientData (
- FWCommandObjectID fwCommandObjectID,
- UInt32 clientData);
-
- OSStatus FWGetSBP2NormalCommandClientData (
- FWCommandObjectID fwCommandObjectID,
- UInt32 *pClientData);
-
- OSStatus FWSetSBP2NormalCommandGeneration (
- FWCommandObjectID fwCommandObjectID,
- UInt32 generation);
-
- OSStatus FWGetSBP2NormalCommandGeneration (
- FWCommandObjectID fwCommandObjectID,
- UInt32 *pGeneration);
-
- OSStatus FWSetSBP2NormalCommandParams (
- FWCommandObjectID fwCommandObjectID,
- UInt32 bufferCount,
- FWAddress *bufferPtrList,
- UInt32 *bufferLengthList,
- Ptr commandBuffer,
- UInt32 commandLength,
- UInt32 normalFlags,
- UInt32 maxPayloadSize,
- Duration timeoutDuration,
- UInt32 clientData);
-
- OSStatus FWGetSBP2NormalCommandParams (
- FWCommandObjectID fwCommandObjectID,
- FWCommandObjectID *pFWLoginCommandObjectID,
- UInt32 *pBufferCount,
- FWAddress *bufferPtrList,
- UInt32 *bufferLengthList,
- Ptr commandBuffer,
- UInt32 *pCommandLength,
- UInt32 *pNormalFlags,
- UInt32 *pMaxPayloadSize,
- Duration *pTimeoutDuration,
- UInt32 *pClientData);
-
- OSStatus FWGetSBP2NormalCommandObjectIDFromORB_POINTER (
- FWCommandObjectID fwLoginCommandObjectID,
- FWAddress ORB_POINTER,
- FWCommandObjectID *pFWCommandObjectID);
-
- OSStatus FWAppendSBP2Command (
- FWCommandObjectID fwCommandObjectID);
-
- OSStatus FWAllocateSBP2ManagementCommandObject (
- FWReferenceID fwReferenceID,
- FWCommandObjectID *pFWCommandObjectID);
-
- OSStatus FWSetSBP2ManagementCommandFunction (
- FWCommandObjectID fwCommandObjectID,
- UInt32 function);
-
- OSStatus FWGetSBP2ManagementCommandFunction (
- FWCommandObjectID fwCommandObjectID,
- UInt32 *pFunction);
-
- OSStatus FWSetSBP2ManagementCommandCommandID (
- FWCommandObjectID fwManagementCommandObjectID,
- FWCommandObjectID fwCommandObjectID);
-
- OSStatus FWGetSBP2ManagementCommandCommandID (
- FWCommandObjectID fwManagementCommandObjectID,
- FWCommandObjectID *pFWCommandObjectID);
-
- OSStatus FWSetSBP2ManagementCommandResponseBuffer (
- FWCommandObjectID fwCommandObjectID,
- Ptr responseBuffer,
- UInt32 maxResponseSize);
-
- OSStatus FWGetSBP2ManagementCommandResponseBuffer (
- FWCommandObjectID fwCommandObjectID,
- Ptr *pResponseBuffer,
- UInt32 *pMaxResponseSize);
-
- OSStatus FWSBP2Login (
- FWCommandObjectID fwCommandObjectID);
-
- OSStatus FWSBP2Logout (
- FWCommandObjectID fwCommandObjectID);
-
- OSStatus FWSBP2Manage (
- FWCommandObjectID fwCommandObjectID);
-
- OSStatus FWGetSBP2LUNFromFWReferenceID (
- FWReferenceID fwReferenceID,
- UInt32 *pLUN);
-
- // Not SBP-2 specific - move near similar calls.
-
- OSStatus FWAllocateFWCommandObjectMemory (
- FWCommandObjectID fwCommandObjectID,
- UInt32 byteCount);
-
- OSStatus FWGetFWReferenceIDFromUniqueID (
- FWReferenceID fwReferenceID,
- CSRNodeUniqueID csrNodeUniqueID,
- FWReferenceID *pFWReferenceID);
-
-
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=reset
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import off
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __FIREWIRESBP2__ */
-